package me.zk.practice1.file;

import java.io.File;

/**
 * @author zhangkai
 * @date 2023/7/31 16:06
 */
public class OutPutFileNameDemo {

    public static void main(String[] args) {
        File file = new File("/Users/zhangkai/ideaproject/practice/practice1/src/main/java/me/zk/practice1");
        printFile(file);
    }

    public static void printFile(File file) {
        if (file == null) {
            return;
        }
        File[] files = file.listFiles();
        for (File f : files) {
            if (f.isDirectory()) {
                System.out.println("文件夹:" + f.getName());
                printFile(f);
            }else {
                System.out.println("普通文件:" + f.getName());
            }

        }
    }
}
